'use strict';

//服务启动 修改代码自动重启
const server = require('gulp-develop-server');
const cfgUtil = require('../../server/commons/factories/configuration');
const serverCfg = cfgUtil.get('server');
const watcher = require('glob-watcher');

module.exports = function () {
  server.listen({
    path: './app.js',
    env: {
      PORT: serverCfg.PORT,
      NODE_ENV: 'development',
      DEBUG: serverCfg.APP_NAME
    }
  });
  // 监听文件的改变 重启服务
  watcher(['app.js', 'conf/**/*.js', 'server/**/*.js'], server.restart);
};